import request from '@/utils/request'

enum Api {
  tongji = '/index/statistic',
  multlist = '/index/getPatrolJobMultiTerminalList',
  point = '/index/getPointVOList',
  device = '/index/getDeviceInfo',
  defect = '/index/getDeviceDefectInfo',
  camera = '/index/getCameraList',
  uav = ''
}

/**
 * 统计数据
 * @param
 */
export const statistic = async () => {
  return await request.get(Api.tongji)
}

/**
 * 多终端巡视任务列表
 * @param
 */
export const patrolJobMultiTerminal = async () => {
  return await request.get(Api.multlist)
}

/**
 * 多终端巡视任务点位列表
 * @param jobId
 */
export const pointVOList = async (params: { jobId: number }) => {
  return await request.get(Api.point, { params })
}

/**
 * 设备详情
 * @param
 */
export const deviceInfo = async (params: {
  jobId: number | string
  deviceId: number | string
}) => {
  return await request.get(Api.device, { params })
}

/**
 * 设备缺陷详情
 * @param id
 */
export const defectInfo = async (params: { id: number | string }) => {
  return await request.get(Api.defect, { params })
}

export const indexDeviceDeInfo = async (data: {
  id: null | string
  tagId?: any
  modelCameraId?: undefined | string
}) => {
  return await request.post('/index/getIndexDeviceDefectInfo', { data })
}

/**
 * 摄像机列表
 * @param
 */
export const cameraList = async () => {
  return await request.get(Api.camera)
}

/**
 * 摄像机巡视点位列表
 * @param data
 */
export const cameraPointInfo = async (data: {
  id: null | string
  tagId?: any
  modelCameraId?: undefined | string
}) => {
  return await request.post('/index/getCameraPointInfo', { data })
}

/**
 * 摄像机巡视点位 - 移动指定相机预置位
 * @param data
 */
export const moveCameraPoint = async (data: {
  id?: undefined | string
  positionNum?: undefined | string
}) => {
  return await request.post('/camera/goToPresetLocation', { data })
}

/**
 * 设备详情
 * @param data
 */
export const deviceDeInfo = async (data: {
  id: null | string
  tagId?: null | string
  deviceId?: null | string
}) => {
  return await request.post('/index/queryDeviceDetailInfo', { data })
}

/**
 * 无人机巡视点缺陷详情
 * @param id
 */
export const uavDeInfo = async (params: { id: number | string }) => {
  return await request.get('/patrolJobDefect/loadDetailInfo', { params })
}

/**
 * 标签控制列表
 * @param
 */
export const labelList = async () => {
  return await request.get('/index/getIndexLabelControl')
}

/**
 * 修改标签控制
 * @param
 */
export const editLabel = async (data: {
  id: null | string
  labelName: null | string
  isOpen: null | string
}) => {
  return await request.post('/index/updateIndexLabelControl', { data })
}

/**
 * 标签控制列表
 * @param
 */
export const queryType = async (id: number | string) => {
  return await request.get(`/index/queryIdType/${id}`)
}
